import FishBase from "./FishBase";
import FishNetManager from "../../script/game/manager/FishNetManager";
import BulletManager from "../../script/game/manager/BulletManager";
const { ccclass, property } = cc._decorator;

@ccclass
export default class FishBulletBase extends cc.Component {


    public bulletType: number = 0;

    public targetP: cc.Vec2;

    onLoad() {
    }

    start() {

    }

    onCollisionEnter(other:cc.Node, self:cc.Node) {
        // Logger.log("onCollisionEnter=FishBulletBase=", other, self)
        if(other){
            let fish:FishBase = other.getComponent(FishBase);
            if(fish && !fish.isDead){
                FishNetManager.instance.addFishNet(this.bulletType, this.node.getPosition())
                BulletManager.instance.killBullet(this);
                fish.blood -= (this.bulletType+1);
                // fish.blood -= 100
                if(fish.blood <= 0){
                    fish.playDeadMv();
                }
            }
        }
    }

}
